﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Lilium.Web.Mvc
{
	public struct ModelRegistrationOptions
	{
        public static ModelRegistrationOptions None = new ModelRegistrationOptions(ModelRegistrationTarget.None, null, null);
        public static ModelRegistrationOptions Model = new ModelRegistrationOptions(ModelRegistrationTarget.Model, null, null);
        public static ModelRegistrationOptions ViewData = new ModelRegistrationOptions(ModelRegistrationTarget.ViewData, null, null);

        /// <summary>
        /// Creates ModelRegistrationOptions with specified name and type. Uses <see cref="ModelRegistrationTarget.ViewData"/> as the target.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="type"></param>
        public ModelRegistrationOptions(string name, Type type)
        {
            m_Name = name;
            m_Target = ModelRegistrationTarget.ViewData;
            m_Type = type;
        }

        public ModelRegistrationOptions(ModelRegistrationTarget target, string name, Type type)
        {
            m_Name = name;
            m_Target = target;
            m_Type = type;
        }

        #region public string Name

        private readonly string m_Name;

        public string Name
        {
            get
            {
                return m_Name;
            }
        }

        #endregion

        #region public ModelRegistrationTarget Target

        private readonly ModelRegistrationTarget m_Target;

        public ModelRegistrationTarget Target
        {
            get
            {
                return m_Target;
            }
        }

        #endregion

        #region public Type Type

        private readonly Type m_Type;

        public Type Type
        {
            get
            {
                return m_Type;
            }
        }

        #endregion
	}

    public enum ModelRegistrationTarget
    {
        None = 0,
        Model = 1,
        ViewData = 2
    }
}
